<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <h1>0:0</h1>
    <button class="but1">开始</button>
    <button class="but2">暂停</button>
    <button class="but3">清零</button>
    <script>
        let h=document.querySelector("h1");
        let but1=document.querySelector(".but1");
        let but2=document.querySelector(".but2");
        let but3=document.querySelector(".but3");
        let num=0;
        let num1=0;
        let str;
        but1.addEventListener("click",function(){
            clearInterval(str)
            str=setInterval(() => {
                num++
                if(num==9){
                    num=0;
                    num1++;
                }
                h.innerHTML=`${num1}:${num}`
            },100);
        })
        but2.addEventListener("click",function(){
            clearInterval(str)
        })
        but3.addEventListener("click",function(){
            num=0;
            num1=0;
            clearInterval(str)
            h.innerHTML=`${num1}:${num}`
        })
    </script>
</body>
</html>